.class Les/o7$b;
.super Ljava/lang/Object;
.source "MediaEncoder.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Les/o7;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "b"
.end annotation


# instance fields
.field final synthetic a:Les/o7;


# direct methods
.method private constructor <init>(Les/o7;)V
    .locals 0

    .line 1
    iput-object p1, p0, Les/o7$b;->a:Les/o7;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Les/o7;Les/o7$a;)V
    .locals 0

    .line 2
    invoke-direct {p0, p1}, Les/o7$b;-><init>(Les/o7;)V

    return-void
.end method

.method private a(Ljava/nio/ByteBuffer;IJI)V
    .locals 16

    move-object/from16 v1, p0

    move-object/from16 v0, p1

    move/from16 v2, p2

    .line 1
    iget-object v3, v1, Les/o7$b;->a:Les/o7;

    iget-boolean v3, v3, Les/o7;->s:Z

    if-eqz v3, :cond_c

    iget-object v3, v1, Les/o7$b;->a:Les/o7;

    iget-object v4, v3, Les/o7;->t:Ljava/lang/Exception;

    if-nez v4, :cond_c

    iget-boolean v3, v3, Les/o7;->i:Z

    if-eqz v3, :cond_0

    goto/16 :goto_5

    :cond_0
    const/4 v3, 0x0

    const/4 v4, 0x0

    :cond_1
    const/4 v5, 0x1

    .line 2
    :try_start_0
    iget-object v6, v1, Les/o7$b;->a:Les/o7;

    iget-boolean v6, v6, Les/o7;->s:Z

    if-eqz v6, :cond_c

    .line 3
    iget-object v6, v1, Les/o7$b;->a:Les/o7;

    iget-object v6, v6, Les/o7;->f:Ljava/lang/Object;

    monitor-enter v6
    :try_end_0
    .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_0

    .line 4
    :try_start_1
    iget-object v7, v1, Les/o7$b;->a:Les/o7;

    iget-object v7, v7, Les/o7;->t:Ljava/lang/Exception;

    if-eqz v7, :cond_2

    .line 5
    monitor-exit v6

    return-void

    .line 6
    :cond_2
    monitor-exit v6
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    if-gtz v2, :cond_3

    add-int/lit8 v4, v4, 0x1

    const/16 v6, 0xa

    if-le v4, v6, :cond_3

    .line 7
    :try_start_2
    iget-object v0, v1, Les/o7$b;->a:Les/o7;

    const-string v3, "stop send BUFFER_FLAG_END_OF_STREAM. saw input eos"

    invoke-virtual {v0, v3}, Les/o7;->a(Ljava/lang/String;)V

    .line 8
    iget-object v0, v1, Les/o7$b;->a:Les/o7;

    iput-boolean v5, v0, Les/o7;->i:Z

    goto/16 :goto_5

    .line 9
    :cond_3
    iget-object v6, v1, Les/o7$b;->a:Les/o7;

    iget-object v6, v6, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    const-wide/32 v7, 0xc350

    invoke-virtual {v6, v7, v8}, Lcom/esfile/screen/recorder/media/util/n;->a(J)I

    move-result v10

    if-ltz v10, :cond_1

    .line 10
    iget-object v4, v1, Les/o7$b;->a:Les/o7;

    iget-object v4, v4, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    invoke-virtual {v4, v10}, Lcom/esfile/screen/recorder/media/util/n;->a(I)Ljava/nio/ByteBuffer;

    move-result-object v4

    if-eqz v4, :cond_c

    .line 11
    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;

    if-eqz v0, :cond_5

    .line 12
    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v6

    if-le v2, v6, :cond_4

    .line 13
    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v6

    goto :goto_0

    :cond_4
    move v6, v2

    .line 14
    :goto_0
    invoke-virtual {v0, v3}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;

    .line 15
    invoke-virtual {v0, v6}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;

    .line 16
    invoke-virtual {v4, v0}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;

    move v12, v6

    goto :goto_1

    :cond_5
    move v12, v2

    :goto_1
    and-int/lit8 v0, p5, 0x4

    if-eqz v0, :cond_6

    const/4 v0, 0x1

    goto :goto_2

    :cond_6
    const/4 v0, 0x0

    :goto_2
    if-lez v2, :cond_8

    if-eqz v0, :cond_7

    goto :goto_3

    .line 17
    :cond_7
    iget-object v0, v1, Les/o7$b;->a:Les/o7;

    iget-object v9, v0, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    const/4 v11, 0x0

    const/4 v15, 0x0

    move-wide/from16 v13, p3

    invoke-virtual/range {v9 .. v15}, Lcom/esfile/screen/recorder/media/util/n;->a(IIIJI)V

    goto/16 :goto_5

    .line 18
    :cond_8
    :goto_3
    iget-object v0, v1, Les/o7$b;->a:Les/o7;

    iput-boolean v5, v0, Les/o7;->i:Z

    .line 19
    iget-object v0, v1, Les/o7$b;->a:Les/o7;

    const-string v4, "send BUFFER_FLAG_END_OF_STREAM"

    invoke-virtual {v0, v4}, Les/o7;->a(Ljava/lang/String;)V

    if-gtz v2, :cond_9

    const/4 v12, 0x0

    goto :goto_4

    :cond_9
    move v12, v2

    .line 20
    :goto_4
    iget-object v0, v1, Les/o7$b;->a:Les/o7;

    iget-object v9, v0, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    const/4 v11, 0x0

    const/4 v15, 0x4

    move-wide/from16 v13, p3

    invoke-virtual/range {v9 .. v15}, Lcom/esfile/screen/recorder/media/util/n;->a(IIIJI)V
    :try_end_2
    .catch Ljava/lang/IllegalStateException; {:try_start_2 .. :try_end_2} :catch_0

    goto :goto_5

    :catchall_0
    move-exception v0

    .line 21
    :try_start_3
    monitor-exit v6
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    :try_start_4
    throw v0
    :try_end_4
    .catch Ljava/lang/IllegalStateException; {:try_start_4 .. :try_end_4} :catch_0

    :catch_0
    move-exception v0

    .line 22
    instance-of v3, v0, Landroid/media/MediaCodec$CodecException;

    if-eqz v3, :cond_a

    .line 23
    move-object v3, v0

    check-cast v3, Landroid/media/MediaCodec$CodecException;

    .line 24
    iget-object v4, v1, Les/o7$b;->a:Les/o7;

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "feedInputBuffer error isTransient:"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 25
    invoke-virtual {v3}, Landroid/media/MediaCodec$CodecException;->isTransient()Z

    move-result v7

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    const-string v7, " isRecoverable:"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Landroid/media/MediaCodec$CodecException;->isRecoverable()Z

    move-result v3

    invoke-virtual {v6, v3}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    .line 26
    invoke-virtual {v4, v3}, Les/o7;->a(Ljava/lang/String;)V

    .line 27
    :cond_a
    invoke-virtual {v0}, Ljava/lang/IllegalStateException;->printStackTrace()V

    if-gtz v2, :cond_b

    .line 28
    iget-object v2, v1, Les/o7$b;->a:Les/o7;

    const-string v3, "send BUFFER_FLAG_END_OF_STREAM failed"

    invoke-virtual {v2, v3}, Les/o7;->a(Ljava/lang/String;)V

    .line 29
    iget-object v2, v1, Les/o7$b;->a:Les/o7;

    iput-boolean v5, v2, Les/o7;->i:Z

    const-string v2, "send eos failed"

    .line 30
    invoke-static {v2, v0}, Les/la;->a(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_5

    .line 31
    :cond_b
    iget-object v2, v1, Les/o7$b;->a:Les/o7;

    iget-boolean v3, v2, Les/o7;->i:Z

    if-nez v3, :cond_c

    .line 32
    new-instance v3, Ljava/lang/Exception;

    const-string v4, "feedInputBuffer error"

    invoke-direct {v3, v4, v0}, Ljava/lang/Exception;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    invoke-virtual {v2, v3}, Les/o7;->b(Ljava/lang/Exception;)V

    :cond_c
    :goto_5
    return-void
.end method


# virtual methods
.method public run()V
    .locals 12

    .line 1
    iget-object v0, p0, Les/o7$b;->a:Les/o7;

    iget-object v0, v0, Les/o7;->f:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_0
    iget-object v1, p0, Les/o7$b;->a:Les/o7;

    const/4 v2, 0x1

    invoke-static {v1, v2}, Les/o7;->a(Les/o7;Z)Z

    .line 3
    iget-object v1, p0, Les/o7$b;->a:Les/o7;

    iget-object v1, v1, Les/o7;->f:Ljava/lang/Object;

    invoke-virtual {v1}, Ljava/lang/Object;->notifyAll()V

    .line 4
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_2

    .line 5
    iget-object v0, p0, Les/o7$b;->a:Les/o7;

    invoke-virtual {v0}, Les/o7;->j()V

    const-wide/16 v0, 0x0

    .line 6
    :cond_0
    :goto_0
    iget-object v3, p0, Les/o7$b;->a:Les/o7;

    iget-boolean v3, v3, Les/o7;->h:Z

    const/4 v4, 0x0

    if-nez v3, :cond_4

    const/4 v3, 0x0

    .line 7
    iget-object v5, p0, Les/o7$b;->a:Les/o7;

    iget-object v5, v5, Les/o7;->f:Ljava/lang/Object;

    monitor-enter v5

    .line 8
    :try_start_1
    iget-object v6, p0, Les/o7$b;->a:Les/o7;

    iget-boolean v6, v6, Les/o7;->h:Z

    if-nez v6, :cond_1

    iget-object v6, p0, Les/o7$b;->a:Les/o7;

    invoke-static {v6}, Les/o7;->d(Les/o7;)Ljava/util/List;

    move-result-object v6

    invoke-interface {v6}, Ljava/util/List;->isEmpty()Z

    move-result v6
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    if-eqz v6, :cond_1

    .line 9
    :try_start_2
    iget-object v6, p0, Les/o7$b;->a:Les/o7;

    iget-object v6, v6, Les/o7;->f:Ljava/lang/Object;

    invoke-virtual {v6}, Ljava/lang/Object;->wait()V
    :try_end_2
    .catch Ljava/lang/InterruptedException; {:try_start_2 .. :try_end_2} :catch_0
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_1

    .line 10
    :catch_0
    :try_start_3
    monitor-exit v5

    goto :goto_3

    .line 11
    :cond_1
    :goto_1
    iget-object v6, p0, Les/o7$b;->a:Les/o7;

    invoke-static {v6}, Les/o7;->d(Les/o7;)Ljava/util/List;

    move-result-object v6

    invoke-interface {v6}, Ljava/util/List;->isEmpty()Z

    move-result v6

    if-nez v6, :cond_2

    .line 12
    iget-object v3, p0, Les/o7$b;->a:Les/o7;

    invoke-static {v3}, Les/o7;->d(Les/o7;)Ljava/util/List;

    move-result-object v3

    invoke-interface {v3, v4}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lcom/esfile/screen/recorder/media/util/l;

    .line 13
    :cond_2
    monitor-exit v5
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    if-eqz v3, :cond_0

    .line 14
    iget-wide v0, v3, Lcom/esfile/screen/recorder/media/util/l;->c:J

    .line 15
    iget-object v6, v3, Lcom/esfile/screen/recorder/media/util/l;->b:Ljava/nio/ByteBuffer;

    invoke-virtual {v3}, Lcom/esfile/screen/recorder/media/util/l;->b()I

    move-result v7

    iget-wide v8, v3, Lcom/esfile/screen/recorder/media/util/l;->c:J

    iget-object v5, v3, Lcom/esfile/screen/recorder/media/util/l;->f:Landroid/media/MediaCodec$BufferInfo;

    if-eqz v5, :cond_3

    iget v4, v5, Landroid/media/MediaCodec$BufferInfo;->flags:I

    move v10, v4

    goto :goto_2

    :cond_3
    const/4 v10, 0x0

    :goto_2
    move-object v5, p0

    invoke-direct/range {v5 .. v10}, Les/o7$b;->a(Ljava/nio/ByteBuffer;IJI)V

    .line 16
    invoke-virtual {v3}, Lcom/esfile/screen/recorder/media/util/l;->a()V

    .line 17
    iget-object v3, p0, Les/o7$b;->a:Les/o7;

    invoke-virtual {v3}, Les/o7;->u()V

    goto :goto_0

    :catchall_0
    move-exception v0

    .line 18
    :try_start_4
    monitor-exit v5
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0

    throw v0

    .line 19
    :cond_4
    :goto_3
    iget-object v3, p0, Les/o7$b;->a:Les/o7;

    invoke-virtual {v3}, Les/o7;->C()Z

    move-result v3

    if-nez v3, :cond_5

    iget-object v3, p0, Les/o7$b;->a:Les/o7;

    iget-boolean v5, v3, Les/o7;->i:Z

    if-nez v5, :cond_5

    const-string v5, "sending EOS to encoder"

    .line 20
    invoke-virtual {v3, v5}, Les/o7;->a(Ljava/lang/String;)V

    const/4 v7, 0x0

    const/4 v8, 0x0

    const-wide/16 v5, 0x2710

    add-long v9, v0, v5

    const/4 v11, 0x4

    move-object v6, p0

    .line 21
    invoke-direct/range {v6 .. v11}, Les/o7$b;->a(Ljava/nio/ByteBuffer;IJI)V

    .line 22
    iget-object v0, p0, Les/o7$b;->a:Les/o7;

    iput-boolean v2, v0, Les/o7;->i:Z

    .line 23
    :cond_5
    iget-object v0, p0, Les/o7$b;->a:Les/o7;

    iget-object v1, v0, Les/o7;->f:Ljava/lang/Object;

    monitor-enter v1

    .line 24
    :try_start_5
    iget-object v0, p0, Les/o7$b;->a:Les/o7;

    invoke-static {v0, v4}, Les/o7;->a(Les/o7;Z)Z

    .line 25
    iget-object v0, p0, Les/o7$b;->a:Les/o7;

    iget-object v0, v0, Les/o7;->f:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 26
    monitor-exit v1

    return-void

    :catchall_1
    move-exception v0

    monitor-exit v1
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_1

    throw v0

    :catchall_2
    move-exception v1

    .line 27
    :try_start_6
    monitor-exit v0
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_2

    goto :goto_5

    :goto_4
    throw v1

    :goto_5
    goto :goto_4
.end method
